<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<!DOCTYPE html>
<html>
<head>
<base href="<%=basePath%>">
<meta charset="UTF-8">
<title>bbs.jsp</title>
<script type="text/javascript" src="js/jquery.js"></script>
<script>
	$(function() {
		$.get("sort/getSort", function(res) {
			var sel = $("#sel");
			var option = "<option value='0'>全部</option>";
			sel.append(option);
			$(res).each(
					function() {
						var option = "<option value='"+this.id+"'>" + this.name
								+ "</option>";
						sel.append(option);
					});
		}, 'json');
	});

	$(function() {
		$("#btn").click(function() {
			location = "detail/toAddDetail";
		});
	});
</script>
</head>
<body>
	<div class="box" align="center">
		<form method="get" action="detail/getDetail">
			<span>讨论版区</span> <select name="sortId" id="sel">
			</select>
			<input type="submit" value="搜索"/>
		</form>
		<div style="margin-right: -750px">
			<button id="btn">发帖</button>
		</div>
		<br />
		<table align="center" border="1" class="providerTable" cellpadding="0"
			cellspacing="0" style="text-align: center; width: 60%">
			<tr class="fir">
				<th width="5%">帖子ID</th>
				<th width="20%">标题</th>
				<th width="10%">作者</th>
				<th width="22%">发布时间</th>
				<th width="8%">回复次数</th>
			</tr>
			<c:forEach items="${LIST }" var="bbs">
				<tr>
					<td>${bbs.id }</td>
					<td>${bbs.title}</td>
					<td>${bbs.author}</td>
					<td>${bbs.createDate}</td>
					<td>${bbs.replyCount}</td>
				</tr>
			</c:forEach>
		</table>
	</div>
</body>
</html>